//
//  VC2Slider.swift
//  ChapterAll
//
//  Created by Kevin on 2020/4/22.
//  Copyright © 2020 Kevin. All rights reserved.
//

import UIKit

class VC2Slider: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        let slider = UISlider(frame: CGRect(x: 20, y: 200, width: 280, height: 40))
        slider.minimumValue = 0
        slider.maximumValue = 10
        slider.minimumTrackTintColor = UIColor.red
        slider.maximumTrackTintColor = UIColor.orange
        slider.thumbTintColor = UIColor.blue
        view.addSubview(slider)
        
        slider.minimumValueImage = UIImage(named: "ic_action_anchor")
        slider.maximumValueImage = UIImage(named: "ic_action_anchor")
        slider.setThumbImage(UIImage(named: "ic_action_anchor"), for: .normal)
        
        slider.addTarget(self, action: #selector(clickSlider(ui:)), for: .valueChanged)
    }
    
    @objc func clickSlider(ui:UISlider) -> Void {
        print("\(ui.value)")
    }
}
